package com.salt.modules.notice.feign;

import com.salt.common.constant.Common;
import com.salt.modules.notice.entity.NoticeData;
import com.salt.modules.notice.hystrix.SendNoticeClientHystrix;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Set;

/**
 * @Description 消息通知中心远程调用接口
 * @Author salt
 * @Date 2021/11/4
 * @Version 1.0.1
 */
@FeignClient(name = Common.Service.SALT_NOTICE_SERVICE_NAME,
        path = Common.Service.SALT_NOTICE_SEND_URL_PREFIX,
        fallbackFactory = SendNoticeClientHystrix.class)
public interface SendNoticeClient {

    String API_PREFIX = "/client";
    String PC = API_PREFIX + "/pc";
    String BROWSER = API_PREFIX + "/browser";
    String PC_BATCH = API_PREFIX + "/pcBatch";
    String APP = API_PREFIX + "/app";
    String PCAPP = API_PREFIX + "/pcapp";

    /**
     * PC端消息通知
     * @param data
     * @param userIds
     */
    @PostMapping(PC)
    public void pc(@RequestBody NoticeData data, @RequestParam("userIds") Set<String> userIds);

    /**
     * PC端消息通知
     * @param data
     */
    @PostMapping(BROWSER)
    public void pc(@RequestBody NoticeData data);

    /**
     * PC端批量发送消息通知
     * @param notices
     */
    @PostMapping(PC_BATCH)
    public void pcBatch(@RequestParam("notices") String notices);

    /**
     * APP消息通知
     * @param data
     * @param userIds
     */
    @PostMapping(APP)
    public void app(@RequestBody NoticeData data, @RequestParam("userIds") Set<String> userIds);

    /**
     * PC端和APP同时发送消息通知
     * @param data
     * @param userIds
     */
    @PostMapping(PCAPP)
    public void pcapp(@RequestBody NoticeData data, @RequestParam("userIds") Set<String> userIds);
}
